package com.wang.controller;

import com.aaa.entity.BBusinessInfo;
import com.aaa.entity.EExamine;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wang.service.BBusinessInfoService;
import com.wang.service.EExamineService;
import com.wang.service.EmpVoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author :  DongZheng Wang
 * @PROJECT_NAME: fifth-cai-parent
 * @date :  2023-02-28 15:34
 **/

@RestController
@RequestMapping("/emp1")
public class EmpVo1Controller {
    @Autowired
    private EmpVoService empVoService;
    @Autowired
    private BBusinessInfoService bBusinessInfoService;
    @Autowired
    private EExamineService eExamineService;

    @RequestMapping("/examine/getExamine")
    public Result empVo1(Integer currentPage, Integer pageSize, String startTime, String endTime) {
        Result result = empVoService.empVo1(currentPage, pageSize, startTime, endTime);
        return new Result(2000, "success", result);
    }

    @RequestMapping("/examine/selectBusiness")
    public Result getShop() {
        List<BBusinessInfo> list = bBusinessInfoService.list();
        return new Result(2000, "sucess", list);
    }


    /***
     * 添加检查用户
     */
    @RequestMapping("/examine/insertExamine")
    public Result insertExamine(@RequestBody EExamine eExamine) {
        boolean save = eExamineService.save(eExamine);
        return new Result(2000, "success");
    }

    /**
     * 删除操作
     */
    @RequestMapping("/examine/deleteExamine")
    public Result deleteExamine(String id) {
        LambdaQueryWrapper<EExamine> queryWrapper = new LambdaQueryWrapper<EExamine>();
        queryWrapper.eq(EExamine::getId, id);
        eExamineService.remove(queryWrapper);
        return new Result(2000, "success", queryWrapper);
    }
}
